import java.util.ArrayList;
import java.util.List;

// 基类 EmployeeDetails
abstract class EmployeeDetails {
    protected String name;
    protected float salary;

    public EmployeeDetails(String name) {
        this.name = name;
    }

    // 抽象方法
    public abstract void calculateSalary();
}

// 子类 SalariedEmployee
class SalariedEmployee extends EmployeeDetails {
    private float monthlySalary;

    public SalariedEmployee(String name, float monthlySalary) {
        super(name);
        this.monthlySalary = monthlySalary;
    }

    @Override
    public void calculateSalary() {
        System.out.println(name + "'s salary (monthly) is: " + monthlySalary);
    }
}

// 子类 HourlyEmployee
class HourlyEmployee extends EmployeeDetails {
    private float hourlySalary;
    private int hoursWorked;

    public HourlyEmployee(String name, float hourlySalary, int hoursWorked) {
        super(name);
        this.hourlySalary = hourlySalary;
        this.hoursWorked = hoursWorked;
    }

    @Override
    public void calculateSalary() {
        float totalSalary = hourlySalary * hoursWorked;
        System.out.println(name + "'s salary (hourly a day) is: " + totalSalary);
    }
}

// 主类 Employee
public class Employee {
    public static void main(String[] args) {
        // 员工名称数组
        String[] employeeNames = {
                "Louis", "Lino", "Mike", "Lily", "Tom", "Grace", "Moly", "Ronald", "Wilson", "Kelly"
        };

        // 小时工时薪数组
        float[] hourlySalaries = {58.16f, 50.38f, 59.23f, 59.46f, 52.75f, 47.98f, 51.05f, 56.78f, 53.37f, 40.95f};

        // 小时工工时数组
        int[] hoursWorked = {5, 4, 5, 6, 5, 6, 7, 4, 6, 4};

        // 月薪工作人员月薪数组
        float[] monthlySalaries = {
                21737.09f, 22517.04f, 18739.86f, 12029.53f, 15657.3f, 13136.08f, 15159.52f, 20597.57f, 21609.91f, 18660.92f
        };

        // 0-1数组（0对应小时工，1对应月薪工作者）
        int[] employeeTypes = {1, 1, 0, 1, 0, 0, 1, 1, 1, 1};

        // 创建员工列表
        List<EmployeeDetails> employees = new ArrayList<>();

        // 根据类型添加员工到列表
        for (int i = 0; i < employeeNames.length; i++) {
            if (employeeTypes[i] == 0) {
                employees.add(new HourlyEmployee(employeeNames[i], hourlySalaries[i], hoursWorked[i]));
            } else {
                employees.add(new SalariedEmployee(employeeNames[i], monthlySalaries[i]));
            }
        }

        // 计算并输出每个员工的薪水
        for (EmployeeDetails employee : employees) {
            employee.calculateSalary();
        }
    }
}
